<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>美嘉饲料</title>
<link href="<%=basePath%>skin/css/public.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>skin/css/bbsDetail.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="<%=basePath%>skin/css/bootstrap.css" >
<script type="text/javascript" src="<%=basePath%>skin/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/sdmenu.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/select-widget-min.js"></script>	
<script type="text/javascript" src="<%=basePath%>skin/js/public.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/bootstrap/bootstrap-paginator.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/validform/Validform_v5.3.2_min.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/editor/kindeditor.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/jquery.tools.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/common.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	navi()
}); 
$().ready(function(){
	//验证
	var validform = $("#form1").Validform({
		btnSubmit:"#save",
		tiptype:3,
		beforeSubmit:function(curform){
			var content =$("#editor").val();
			if(content == null || content == "") {
				alert("请输入内容！");
				return false;
			}
		}
	});
	var currentPage = "${pagination.currentPage}";
	var totalPages = "${pagination.pageCount}";
	var numberOfPages = "${pagination.pageSize}";
	var keyword = encodeURI("${paramBean.keyword }");
	var productCategoryId = "${forumTopic.productCategory.id}";
	var id = "${forumTopic.id}";
    var options = {
		currentPage: currentPage,
		totalPages: totalPages,
		numberOfPages: numberOfPages,
		pageUrl:function(type, page, current){
			return basePath+"forumTopic/view.shtml?id="+id+"&keyword="+keyword+"&p="+page+"&productCategoryId="+productCategoryId;
		}
	}
	
    try {
    	$("#paginator").bootstrapPaginator(options);
    } catch (e) {}
});
</script>
</head>
<body>
	<div class="userCenter">
    	<div class="container">
        	<div class="header-wrap">
            	<c:import url="/layouts/top.jsp" />
                <c:import url="/layouts/head.jsp" />
                <div class="nav-warp">
					<div class="nav-main-warp wp">
						<div class="head-v3">
							<div class="navigation-up">
								<div class="navigation-inner">
									<div class="navigation-v3">
										<ul>
											<li class="fLeft navi_product first" _t_nav="product">
												<h2>
													<a href="<%=basePath%>shop/product/list.shtml">全部产品
														<img src="<%=basePath%>skin/images/all-product-arrow.png" />
													</a>
												</h2>
											</li>
											<li class="nav-up-selected-inpage fLeft" _t_nav="home">
												<h2>
													<a href="<%=basePath%>">美嘉商城</a>
												</h2>
											</li>
											<li class="fLeft self_community" _t_nav="community">
												<h2>
													<a href="javascript:void(0)">美嘉社区</a>
												</h2>
											</li>
											<li class="fLeft technology" _t_nav="technology">
												<h2>
													<a href="#">饲养技术</a>
												</h2>
											</li>
											<li class="fLeft server" _t_nav="server">
												<h2>
													<a href="">美嘉服务</a>
												</h2>
											</li>
											<li class="fLeft know" _t_nav="know">
												<h2>
													<a href="aboutMJ.html">了解美嘉</a>
												</h2>
											</li>
											<li class="fLeft navi_cart" _t_nav="cart">
												<h2>
													<a href="<%=basePath%>cart/list.shtml">
														<img src="<%=basePath%>skin/images/cart-icon.png" />购物车（<span id="cartnum">0</span>）
													</a>
												</h2>
											</li>
										</ul>
									</div>
								</div>
							</div>
							<div class="navigation-down">
								<div id="product" class="nav-down-menu menu-1"
									style="display: none;" _t_nav="product">
									<div class="navigation-down-inner">
										<c:forEach items="${productCategoryTree }" var="productCategory">
											<c:if test="${productCategory.grade == 0 }">
												<div class="navi-down-area">
													<a href="<%=basePath%>shop/product/list.shtml?productCategoryId=${productCategory.id }" class="product-cate">
														<img src="<%=basePath%>download.shtml?filepath=${productCategory.source}" />
													</a>
													<ul>
														<li><a href="<%=basePath%>shop/product/list.shtml?productCategoryId=${productCategory.id }">${productCategory.name}</a></li>
														<div class="clear"></div>
													</ul>
												</div>
											</c:if>
										</c:forEach>
									</div>
								</div>
								
								<div id="community" class="nav-down-menu menu-3" style="display: none;" _t_nav="community">
                                    <div class="navigation-down-inner">
                                    	<div class="navi-down-area-second">
                                        	<a href="<%=basePath%>forumTopic/list.shtml" class="product-cate"><img src="<%=basePath%>skin/images/mjbbs.png" /></a>
                                        </div>
                                        <div class="navi-down-area-second">
                                        	<a href="<%=basePath%>collegeTopic/list.shtml" class="product-cate"><img src="<%=basePath%>skin/images/mjschool.png" /></a>
                                        </div>
                                    </div>
                                </div>
							</div>
						</div>
					</div>
				</div>
            </div>
        	<div class="content-wrap">
            	<div class="link_navi wp">
                    <a href="<%=basePath%>">主页</a> > 
                    <a href="<%=basePath%>forumTopic/list.shtml">美嘉论坛</a>> 
                    	帖子详情
                </div>
                <div class="mt20">
                    <div id="ct" class="wp cl ct2 xm_ct2">
                    	<div class="xm_tp">
                        	<div class="xm_p_tp">
                            <a class="xm_avt" href="<%=basePath%>forumTopic/view.shtml?id=${forumTopic.id}">
                                <img src="<%=basePath%>skin/images/max.png" width="48" height="48">
                            </a>
                            <h1>
                                <a id="thread_subject" href="<%=basePath%>forumTopic/view.shtml?id=${forumTopic.id}">${forumTopic.title}</a>
                            </h1>
                            <div class="xm_tp_action">
                                <span>
                                    ${forumTopic.member.username}
                                </span>
                                <span>
                                    	于
                                    <span><fmt:formatDate value="${forumTopic.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></span>
                                </span>
                                <span>
                                    	发表在
                                    <a href="<%=basePath%>forumTopic/list.shtml?productCategoryId=${forumTopic.productCategory.id}">[${forumTopic.productCategory.name}]</a>
                                </span>
                            </div>
                        </div>
                        </div>
                        <div class="mn xm_mn">
                            <div id="postlist" class="pl">
                                <div>
                                    <table class="plhin post_lz">
                                        <tbody>
                                            <tr>
                                                <td class="plc">
                                                    <div class="pct">
                                                        <div class="pcb">
                                                            <div class="t_fsz xm_post_body">
                                                                <table cellspacing="0" cellpadding="0">
                                                                    <tbody>
                                                                        <tr>
                                                                            <td>
                                                                            	${forumTopic.content}
                                                                            </td>
                                                                        </tr>
                                                                    </tbody>
                                                                </table>
                                                            </div>
                                                            <div id="relate_subject"></div>
                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    <div class="post_comment_top">
                                        <a id="comment_top" style="display: block; margin-top: -45px;"></a>
                                        <div style="margin-top: 45px;">
                                            <h2>
                                                	共${ pagination.recordCount}个关于${forumTopic.title}的回复
                                            </h2>
                                        </div>
                                    </div>
                                </div>
                                <div>
                                <c:forEach items="${ pagination.recordList}" var="forumReply">
                                    <table class="plhin">
                                        <tbody>
                                            <tr>
                                                <td class="pls" rowspan="2">
                                                    <div class="pls favatar">
                                                        <div class="avatar">
                                                           <img src="<%=basePath%>skin/images/max.png">
                                                        </div>
                                                    </div>
                                                </td>
                                                <td class="plc">
                                                    <div class="pi">
                                                        <div class="pti">
                                                            <div class="pdbt"> </div>
                                                            <div class="authi">
                                                                <span class="author">
                                                                    ${forumReply.member.username}
                                                                </span>
                                                                <em>
                                                                   	 发表于
                                                                    <span><fmt:formatDate value="${forumReply.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></span>
                                                                </em>
                                                                <c:if test="${member != null && forumReply.member.id == member.id }">
																	<a href="<%=basePath%>member/forumReply/edit.shtml?id=${forumReply.id}">编辑</a>
																	<a href="<%=basePath%>member/forumReply/delete.shtml?id=${forumReply.id}">删除</a>
																</c:if>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="pct">
                                                        <div class="pcb">
                                                            <div class="t_fsz xm_post_body">
                                                                <table>
                                                                    <tbody>
                                                                        <tr>
                                                                            <td class="t_f">${forumReply.content}</td>
                                                                        </tr>
                                                                    </tbody>
                                                                </table>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                               </c:forEach>
                                </div>
                            </div>
                            <div class="pgs cl">
                                <div class="pg" id="paginator">
                                </div>
                            </div>
                            <div id="f_pst" class="pl bm xm_bm">
                            <form id="form1" name="form1" method="post" action="<%=basePath%>member/forumReply/save.shtml">
							<input type="hidden" name="productCategoryId" value="${forumTopic.productCategory.id}" />
							<input type="hidden" name="forumTopicId" value="${forumTopic.id}" />
                                <table>
                                    <tbody>
                                        <tr>
                                            <td class="plc">
                                                <div class="cl">
                                                    <div id="fastposteditor">
                                                        <div class="tedt mtn">
                                                            <div class="area">
                                                                <textarea id="editor" name="content" class="editor pt" style="width: 100%;"></textarea>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <p class="ptm pnpost">
                                                    <button id="save" class="pn pnc" tabindex="5" value="replysubmit" type="button" >
                                                        <strong>回复</strong>
                                                    </button>
                                                    <button class="pn" value="true" type="button" onclick="location.href='<%=basePath%>forumTopic/list.shtml?productCategoryId=${forumTopic.productCategory.id}'">
						                                <em>返回</em>
						                            </button>
                                                </p>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                             </form>
                            </div>
                        </div>
                        <div class="sd xm_sd">
                            <div class="bm xm_bm post_new">
                                <div class="bm_c">
                                    <a class="post_btn" href="#">
                                        <img alt="发新帖" src="<%=basePath%>skin/images/pn_post_big.png">
                                    </a>
                                </div>
                            </div>
                            <div class="activities box">
                                <h4>
                                    <strong>热门产品</strong>
                                    <a class="r" href="<%=basePath%>shop/product/list.shtml"> 更多 ></a>
                                </h4>
                                <c:forEach items="${indexImages }" var="hotImage">
									<c:if test="${hotImage.type == 4 && not empty hotImage.source}">
                                        <dl>
		                                    <dt>
		                                        <a target="_blank"  href="${hotImage.url}">
		                                        <img src="<%=basePath%>download.shtml?filepath=${hotImage.source}" style="width: 125px; height:110px;" title="${hotImage.title}"/>
		                                        	${hotImage.title}
		                                        </a>
		                                    </dt>
                                		</dl>
									</c:if>
								</c:forEach>
                            </div>
                            <div class="bm xm_bm">
                                <div class="bm_h">
                                	<h2>关注我们</h2>
                            	</div>
                                <div class="bm_c">
									<img src="<%=basePath%>skin/images/mj-ercoder.png">
                                </div>
                        	</div>
                    	</div>
					</div>
				</div>
			</div>
			<c:import url="/layouts/foot.jsp" />
        </div>
    </div>
</body>
</html>
